package com.ruoyi.experiment.domain;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 流转对象 circulation
 *
 * @author ruoyi
 * @date 2024-06-05
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class Circulation extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** $column.columnComment */
    private Long id;

    /** 流转岗位 */
    @Excel(name = "流转岗位")
    private Integer circulationType;

    /** 项目名 */
    @Excel(name = "项目id")
    private Long projectId;

    /** 发送日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "发送日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date circulationDate;

    /** 用户 */
    @Excel(name = "用户")
    private String userName;

    /** 消息 */
    @Excel(name = "消息")
    private String circulationSuggestion;

    private Long sampleId;

    private String info;

    private Integer status;

    private List<Long> ids;

    public Map<String,String> infoToMap(){
        String[] split = info.split(";");
        Map<String, String> map = new HashMap<>();
        for (String s : split) {
            String[] entry = s.split(":");
            if (entry.length==2)
                map.put(entry[0],entry[1]);
        }
        return map;
    }


    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("circulationType", getCirculationType())
                .append("projectName", getProjectId())
                .append("circulationDate", getCirculationDate())
                .append("userName", getUserName())
                .append("circulationSuggestion", getCirculationSuggestion())
                .append("ids",getIds())
                .toString();
    }
}
